package com.hz.wjy.mapper;

import com.hz.wjy.model.entity.UserEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserMapper {

    @Insert("INSERT INTO users VALUES (NULL, #{username}, #{realname}, #{student_id}, #{pwd_salt}, #{pwd}, #{pwd_valid_date}, #{user_type}, #{pwd_error_count}, #{grade_id}, #{class_id})")
    void addUser(UserEntity userEntity);

    @Select("select * from users where username = #{username}")
    UserEntity findUserByUsername(@Param("username") String username);

}
